package com.icloud.cer.rest.msg;


public class MessageHolder {
	private long sessionId;
	// 消息类型
	private short command;
	// 消息ID，缓存value中的值
	private long id = 0;
	// 响应消息中，对应请求消息的ID，缓存value中的值
	private long sequence = 0;

	private MessageHeader head;
	
	private boolean timeout;
	// 消息体
	private AbsMsgObject<? extends AbsMsgObject> value;

	public long getSessionId() {
		return sessionId;
	}
	public void setSessionId(long sessionId) {
		this.sessionId = sessionId;
	}
	public MessageHolder(short command) {
		this.command = command;
	}
	public short getCommand() {
		return command;
	}

	public void setCommand(short command) {
		this.command = command;
	}

	public MessageHeader getHead() {
		return head;
	}
	public void setHead(MessageHeader head) {
		this.head = head;
	}
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getSequence() {
		return sequence;
	}

	public void setSequence(long sequence) {
		this.sequence = sequence;
	}

	public AbsMsgObject<? extends AbsMsgObject> getValue() {
		return value;
	}

	public void setValue(AbsMsgObject<? extends AbsMsgObject> value) {
		this.value = value;
	}
	
	public boolean isTimeout() {
		return timeout;
	}
	public void setTimeout(boolean timeout) {
		this.timeout = timeout;
	}
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("command:").append(command).append(",");
		sb.append("id:").append(id).append(",");
		sb.append("sequence:").append(sequence);
		return sb.toString();
	}
	
}
